package vg.main;

import javax.swing.SwingUtilities;

import vg.modules.attribute_panel.AttributePlugin;
import vg.modules.backlight.PathSelectingPlugin;
import vg.modules.conveyor.ConveyorPlugin;
import vg.modules.desktop.DesktopPlugin;
import vg.modules.exporters.GraphMLExporterPlugin;
import vg.modules.filter.FilterPlugin;
import vg.modules.graph_comparison.GraphComparisonPlugin;
import vg.modules.graph_layout_viewer.GraphLayoutPlugin;
import vg.modules.graph_settings.GraphSettingsPlugin;
import vg.modules.help.about.AboutPlugin;
import vg.modules.minimap.MiniMapPlugin;
import vg.modules.navigator.NavigatorPlugin;
import vg.modules.new_graph_model.NewGraphModelPlugin;
import vg.modules.notepad.NotepadPlugin;
import vg.modules.opener.GUIOpener;
import vg.modules.scaling.ZoomPlugin;
import vg.modules.search.SearchPlugin;
import vg.modules.tab_closer.SimpleTabCloser;
import vg.modules.util_plugins.LookAndFeelChanger;
import vg.modules.util_plugins.PanningButtonPlugin;
import vg.modules.util_plugins.UndoRedoButtonPlugin;
import vg.services.main_manager.MainManager;

public class Main {
	public static void main(String[] args) {
		try {
			// set all system services------------
			new MainManager();
			
			SwingUtilities.invokeLater(new Runnable() {
				public void run() {
					try {
						// adding system functions--------
						new NewGraphModelPlugin().install(MainManager.pluginParameter);
						new GUIOpener().install(MainManager.pluginParameter);
						new SimpleTabCloser(MainManager.pluginParameter.userInterface);

						new GraphLayoutPlugin().install(MainManager.pluginParameter);
						new DesktopPlugin().install(MainManager.pluginParameter);
						new FilterPlugin().install(MainManager.pluginParameter);
						new UndoRedoButtonPlugin().install(MainManager.pluginParameter);
						new SearchPlugin().install(MainManager.pluginParameter);
						new GraphSettingsPlugin().install(MainManager.pluginParameter);
						new LookAndFeelChanger().install(MainManager.pluginParameter);
						new NotepadPlugin().install(MainManager.pluginParameter);
						new PathSelectingPlugin().install(MainManager.pluginParameter);
						new AttributePlugin().install(MainManager.pluginParameter);
						//new StorablePlugin().install(MainManager.pluginParameter);
						new ZoomPlugin().install(MainManager.pluginParameter);
						new MiniMapPlugin().install(MainManager.pluginParameter);
						new PanningButtonPlugin().install(MainManager.pluginParameter);
						new AboutPlugin().install(MainManager.pluginParameter);
						new GraphComparisonPlugin().install(MainManager.pluginParameter);
						new GraphMLExporterPlugin().install(MainManager.pluginParameter);
						new ConveyorPlugin().install(MainManager.pluginParameter);
						// panels-------------------------
						new NavigatorPlugin().install(MainManager.pluginParameter);
					} catch (Throwable ex) {
						MainManager.log.printException(ex);
					}
				}
			});
		} catch (Throwable ex) {
			System.err.println(ex.getMessage());
		}
	}
}
